package com.chinacoal.microservice.controller;

import com.chinacoal.microservice.CurrencyClient;
import com.chinacoal.microservice.pojo.*;
import com.chinacoal.microservice.service.CurrencyService;
import com.chinacoal.microservice.util.PassToken;
import com.chinacoal.microservice.util.Result;
import com.chinacoal.microservice.util.UserLoginToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 通用接口-后端控制类
 * @date 2020-11-17 17：56
 */
@RestController
public class CurrencyController implements CurrencyClient {

    @Autowired
    private CurrencyService currencyService;

    /**
     * @Description: 中台登录接口
     * @author zhuliang
     * @date 2020/11/17 18:06
     */
    @Override
    @PassToken
    public Result getLoginPerson(String token, Currency currency) {
        return currencyService.getLoginPerson(token, currency);
    }

    /**
     * @Description: 总登录接口
     * @author zhuliang
     * @date 2021/1/25 11:04
     */
    @Override
    public Result<String> adminLogin(Currency currency) {
        return currencyService.adminLogin(currency);
    }

    /**
     * @Description: 注销登录
     * @author zhuliang
     * @date 2021/1/14 11:50
     */
    @Override
    @UserLoginToken
    public Result logout(String token) {
        return currencyService.logout(token);
    }

    /**
     * @Description: 根据对应的父类id查询对应的子类信息（省，市，区，街道）
     * @author zhuliang
     * @date 2020/11/19 9:14
     */
    @Override
    @PassToken
    public Result<List<CcmsSmartleasingArea>> getParentIdList(Integer parentid) {
        return currencyService.getParentIdList(parentid);
    }

    /**
     * @Description: 查询楼宇模块所有的下拉框数据
     * @author zhuliang
     * @date 2020/11/30 20:48
     */
    @Override
    @UserLoginToken
    public Result<CcmsSmartleasingBasicdata> getAllByBuilding(String token) {
        return currencyService.getAllByBuilding(token);
    }

    /**
     * @Description: 根据一级关联id查询二级信息
     * @author zhuliang
     * @date 2020/11/30 20:48
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingBasicdata>> getAllByTwo(String id, String token) {
        return currencyService.getAllByTwo(id, token);
    }

    /**
     * @Description: 根据一级编码查询所有二级信息
     * @author zhuliang
     * @date 2020/11/30 21:38
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingBasicdata>> getTwoAll(String categoryNumber, String token) {
        return currencyService.getTwoAll(categoryNumber, token);
    }

    /**
     * @Description: 根据编码查询所有一级信息
     * @author zhuliang
     * @date 2020/12/1 9:58
     */
    @Override
    @UserLoginToken
    public Result<List<CcmsSmartleasingBasicdata>> getOneAll(String categoryNumber, String token) {
        return currencyService.getOneAll(categoryNumber, token);
    }

    /**
     * @Description: 根据流水号查询开票信息
     * @author zhuliang
     * @date 2020/12/9 10:32
     */
    @Override
    @PassToken
    public Result<String> getInvoicingBySerialNumber(String serialNumber) {
        return currencyService.getInvoicingBySerialNumber(serialNumber);
    }

    /**
     * @Description: 根据订单号查询开票信息
     * @author zhuliang
     * @date 2020/12/9 10:32
     */
    @Override
    @PassToken
    public Result<String> byOrderNumber(String orderNumber) {
        return currencyService.byOrderNumber(orderNumber);
    }

    /**
     * @Description: 云丁回调接口
     * @author zhuliang
     * @date 2020/12/23 16:32
     */
    @Override
    @PassToken
    public Result getYundingData(YundingCallback yundingCallback) {
        return currencyService.getYundingData(yundingCallback);
    }

    /**
     * @Description: 绿米消息回调接口
     * @author zhuliang
     * @date 2021/1/8 15:19
     */
    @Override
    @PassToken
    public Object getGreenRiceData(GreenRiceCallback greenRiceCallback) {
        return currencyService.getGreenRiceData(greenRiceCallback);
    }

    /**
     * @Description: 读取指定目录的xlsx文件，生成房间数据
     * @author zhuliang
     * @date 2021/1/25 16:21
     */
    @Override
    public Result addRoomByExcel(String url) {
        return currencyService.addRoomByExcel(url);
    }

}
